//
//  SAProductHomeScreenCell.m
//  yidiantong
//
//  Created by 黄志刚 on 2020/10/26.
//

#import "SAProductHomeScreenCell.h"

@interface SAProductHomeScreenCell()

@property (weak, nonatomic)  UIImageView *iconImageView;
@property (weak, nonatomic)  UIView *mongoliaView;
@property (weak, nonatomic)  UIImageView *countImageView;
@property (weak, nonatomic)  UILabel *countLabel;

@end

@implementation SAProductHomeScreenCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if(self  =[super initWithFrame:frame]) {
        [self setUpsUbViews];
    }
    return self;
}
-(void)setUpsUbViews
{
    self.contentView.backgroundColor = [UIColor clearColor];

    UIView *mongoliaView = [[UIView alloc] init];
    mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    [self.contentView addSubview:mongoliaView];
    self.mongoliaView = mongoliaView;
    [mongoliaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(kScaleNum(0)));
        make.top.equalTo(@(kScaleNum(0)));
        make.width.mas_equalTo(kScaleNum(68));
        make.height.mas_equalTo(kScaleNum(25));
    }];
    
    UIImageView *iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Shop_cell2"]];
    iconImageView.frame = SARectMake(0, 0, 68, 25);
    [mongoliaView addSubview:iconImageView];
    self.iconImageView = iconImageView;
    
    UILabel *countLabel = [[UILabel alloc] init];
    countLabel.textAlignment = NSTextAlignmentCenter;
    countLabel.font = kFont(12);
    countLabel.textColor = kGrayColor;
    [mongoliaView addSubview:countLabel];
    self.countLabel = countLabel;
    [countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(kScaleNum(68));
        make.centerY.offset(0);
    }];
    
       UIImageView *selectedImageView = [[UIImageView alloc] init];
    selectedImageView.backgroundColor = kBlackColor;
//       selectedImageView.image = [UIImage imageNamed:@"product_chooseColor_btn_selected_n"];
       selectedImageView.hidden = YES;
       [self.contentView addSubview:selectedImageView];
       _selectedImageView = selectedImageView;
       [selectedImageView mas_makeConstraints:^(MASConstraintMaker *make) {
           make.left.equalTo(@(kScaleNum(0)));
           make.top.equalTo(@(kScaleNum(0)));
           make.width.mas_equalTo(kScaleNum(68));
           make.height.mas_equalTo(kScaleNum(25));
       }];
}


-(void)loadDat:(SAProductHomeScreeningList *)model {
    self.countLabel.text = model.attrName;
    if (model.check == YES) {
        self.iconImageView.hidden = NO;
        self.mongoliaView.backgroundColor = [UIColor whiteColor];
    }else{
        self.iconImageView.hidden = YES;
        self.mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    }
}

-(void)loadAccountDat:(SACurrentAccountHomeScreeningList *)model
{
    self.countLabel.text = model.name;
    if (model.check == YES) {
        self.iconImageView.hidden = NO;
        self.mongoliaView.backgroundColor = [UIColor whiteColor];
    }else{
        self.iconImageView.hidden = YES;
        self.mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    }
}


-(void)loadAccountData:(SAProductHomeScreeningList *)model
{
    self.countLabel.text = model.conditionName;
    if (model.check == YES) {
        self.iconImageView.hidden = NO;
        self.mongoliaView.backgroundColor = [UIColor whiteColor];
    }else{
        self.iconImageView.hidden = YES;
        self.mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    }
}


@end

